#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007 

int dp[51][51][13][13];
int init[51][51];
int V[51][51];
int main()
{
#ifdef LOCAL
    freopen("PREV-28.in", "r", stdin);
#endif
    std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int n, m, k;
    cin >> n >> m >> k;
    for(int i = 1; i <= n; ++i)
    for(int j = 1; j <= m; ++j)
        cin >> V[i][j], V[i][j]+=1;
    
    // 初始化, 选择(1, 1)的时候的最大值
    for(int i = 1; i <= n; ++i)
    {
        for(int j = 1; j <= m; ++j)
        {
            // 初始化
            if(i == 1 || j == 1) dp[i][j][1][V[i][j]] = 1, init[i][j] = 1;
            else init[i][j] = init[i - 1][j] + init[i][j - 1], dp[i][j][1][V[i][j]] = init[i][j];
            for(int kk = 1; kk <= k; ++kk)
            {           
                // 枚举前面的方案当中最大的价值
                for(int v = 1; v <= 12; ++v)
                {
                    // 可以取
                    if(v < V[i][j])
                    {
                        // 可以取且取的情况
                        dp[i][j][kk][V[i][j]] = ( ( (dp[i][j][kk][V[i][j]] + dp[i - 1][j][kk - 1][v] ) % MOD ) + dp[i][j - 1][kk - 1][v]) % MOD;
                        
                        // 可以取且不取的情况
                        dp[i][j][kk][v] =   (dp[i - 1 ][j][kk][v] + dp[i][j - 1][kk][v]) % MOD;
                    } 

                    // 不能取的情况, 则直接copy
                    else if(v > V[i][j])
                    {
                        dp[i][j][kk][v] = (dp[i - 1][j][kk][v] + dp[i][j - 1][kk][v]) % MOD;
                        
                    }
                    // v 和 V[i][j], 则选择和不选择相加即可
                    else
                    {
                        dp[i][j][kk][v] =  (((dp[i][j][kk][v] + dp[i - 1][j][kk][v]) % MOD) + dp[i][j - 1][kk][v]) % MOD;
                    }
                }
            }
            /*
            cout << "(" << i << "," << j << ")" << endl;
            for(int kk = 0; kk <= k; ++kk)
            {
                cout << kk << " : ";
                for(int v = 1; v <= 12; ++v)
                {
                    cout << dp[i][j][kk][v] << " ";
                }
                cout << endl;
            }
            */
        }
    }
    int ans = 0;
    for(int i = 1; i <= 12; ++i)
    {
        ans = (ans + dp[n][m][k][i]) % MOD;
    }
    cout << ans << endl;
    return 0;
}